import {
  YN_SELECT_LIST,
  SUPPLIER_TYPE_SELECT_LIST,
  COMMERCIAL_ACCEPTANCE_LIST
} from '@/pages/supplier/constants/common'
const hrAreaId = localStorage.userInfo ? JSON.parse(localStorage.userInfo).hrAreaId : ''

// 商品信息
const PRODUCT_INFORMATION_FIELDS = [
  { prop: 'mainCategoryCode', label: '主营品类代码', disabled: true },
  { prop: 'mainCategory', label: '主营品类', type: 'categorySelect' },
]

// 管理信息
const MANAGEMENT_INFORMATION_FIELDS = [
  { prop: 'supplierCode', label: '供应商代码', disabled: true },
  { prop: 'supplierName', label: '供应商名称', required: true, maxlength: 100 },
  { prop: 'supplierType',
    label: '供应商类型',
    disabled: true,
    type: 'select',
    options: SUPPLIER_TYPE_SELECT_LIST.filter((item) => {
    // 特殊供应商供应商类型：内部加工供应商、分公司、财务供应商、通用供应商
      return [1005, 1006, 1008, 1010].includes(item.value)
    })
  },
  { prop: 'managementAreaId', label: '供应商管理区域', type: 'managementArea', hrAreaId },
]

// 结算方式
const BILLING_METHOD_FIELDS = [
  // { prop: 'discountTaxRate', label: '贴息部分补税税率', required: true, type: 'select', sysDict: 10100 },
  // { prop: 'discountTaxRate', label: '贴息部分补税税率(%)', required: true, type: 'inputNum', min: 0, max: 30, precision: 4, defaultValue: 0 },
  { prop: 'commercialAcceptanceTypeArray', label: '商业承兑票据类型', type: 'select', multiple: true, collapseTags: false, options: COMMERCIAL_ACCEPTANCE_LIST },
  { prop: 'creditAcceptanceType', label: '信用票据承兑类型' },
  // { prop: 'acceptInvoice', label: '是否承兑', disabled: true, type: 'select', options: YN_SELECT_LIST },
  // { prop: 'acceptBankRequire', label: '承兑银行有无要求', type: 'select', dict: 264 },
  // { prop: 'acceptConversionFactor', label: '承兑折算系数', required: false, disabled: false, type: 'number' },
  // { prop: 'acceptBankRequireRemark', label: '承兑银行要求描述', type: 'annex', typeList: 'xlsx/xls/docx/doc/pdf/jpge/jpg/png' },
]

// 结算信息
const BILLING_INFORMATION_FIELDS = [
  { prop: 'checkoutTime', label: '结账时间', type: 'select', sysDict: 15 },
  { prop: 'paidType', label: '付款方式', disabled: true, type: 'select', sysDict: 10131 },
  { prop: 'checkoutRange', label: '结账区间', type: 'select', sysDict: 10133 },
  // { prop: 'settlementType', label: '结算方式', type: 'select', sysDict: 16, disabledValues: [40904, 40905, 40906, 40907] },
  // { prop: 'creditScale', label: '信用凭证比例（%）', type: 'number', min: 0, max: 100 },
  // { prop: 'creditTerm', label: '信用凭证期限（月）', type: 'number', min: 0, max: 999 },
  { prop: 'invoiceType', label: '发票类型', type: 'select', sysDict: 521 },
  { prop: 'taxBillRate1', label: '税票率1', type: 'select', sysDict: 10100 },
  { prop: 'taxBillRate2', label: '税票率2', type: 'select', sysDict: 10100 },
  { prop: 'taxBillProvideTime', label: '税票提供时间', type: 'select', dict: 111 },
  { prop: 'centralizedSettle', label: '是否集中结账', type: 'select', dict: 18 },
  { prop: 'centralizedSettlePlace', label: '集中结账地', type: 'select', filterable: true, dict: 224 },
]

// 财务信息
const FINANCIAL_INFORMATION_FIELDS = [
  { prop: 'reconciliation', label: '是否对账', disabled: true, type: 'select', dict: 18 },
]

// 交付信息
const DELIVERY_INFORMATION_FIELDS = [
  { prop: 'settleStatus', label: '结账状态', type: 'select', options: YN_SELECT_LIST },
]

export {
  PRODUCT_INFORMATION_FIELDS,
  MANAGEMENT_INFORMATION_FIELDS,
  BILLING_INFORMATION_FIELDS,
  FINANCIAL_INFORMATION_FIELDS,
  DELIVERY_INFORMATION_FIELDS,
  BILLING_METHOD_FIELDS
}
